{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "e56215bcbbced704b936172ad4f1e411",
     "grade": false,
     "grade_id": "cell-daa0acf248678b25",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Shortcuts\n",
    "\n",
    "Shortcut | Command\n",
    "--- | ---\n",
    "Shift+Tab | Open Help\n",
    "Strg+Enter | Run cell\n",
    "Shift+Enter | Run cell and select next cell\n",
    "Alt+Enter | Run cell and insert cell below\n",
    "Strg+# | Convert marked lines into comments (German Keyboard)\n",
    "a | Insert cell above marked cell\n",
    "b | Insert cell below marked cell\n",
    "m | Convert cell to markdown type\n",
    "y | Convert cell to code type\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "eb732b38099d87ab638cf8d4dc1c77b5",
     "grade": false,
     "grade_id": "cell-019787e0536d003e",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Datatypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "4490858a473e83d25fef300141217774",
     "grade": false,
     "grade_id": "cell-4dcd020cfa89b540",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "integer_name = 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "7c6b277e20ea6a38c0e82bd07bb7f3ba",
     "grade": false,
     "grade_id": "cell-3df6aef2784fcde8",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "print(integer_name)\n",
    "floatingpoint = 1.5\n",
    "\n",
    "complexnumber = 1 + 1j\n",
    "\n",
    "string1 = 'absj'\n",
    "string2 = \"ab'sj\"\n",
    "string3 = '''absj'''\n",
    "string4 = \"\"\"absj\"\"\"\n",
    "print(string4)\n",
    "\n",
    "print(f'Integer value: {integer_name}')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "13f6fb3754c40f7399b189bf721cb69e",
     "grade": false,
     "grade_id": "cell-43c90d93065bfa05",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Arithmetic operations"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "3abfd79db0d32a44619f16092e250230",
     "grade": false,
     "grade_id": "cell-8135f83b973b1567",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "1 + 1\n",
    "2 - 1\n",
    "#2 ** 2\n",
    "#10_000\n",
    "#2*10e4\n",
    "#1*10**4\n",
    "#41/2\n",
    "#40//2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "2d14ce5ef075e5411d65a13293c7ffa2",
     "grade": false,
     "grade_id": "cell-eebdde86f62071e8",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Collections"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "9298d30e385aa31d9bf4d48209588b7d",
     "grade": false,
     "grade_id": "cell-e941617baf2a039b",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# List\n",
    "\n",
    "l = [integer_name, '123', [1, 2, 3,4 ], 1 + 1j]\n",
    "print(l)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "95b489fdd5b8ed6213b75575d0099b86",
     "grade": false,
     "grade_id": "cell-060aeed43e4a6a13",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "l.append(5)\n",
    "l"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "22430a96ebf3572702fd715ef6918352",
     "grade": false,
     "grade_id": "cell-600db0325040c35a",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "m = [30, 40]\n",
    "l.extend(m)\n",
    "l"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "e9643e88e9540f39d75e127466637ba3",
     "grade": false,
     "grade_id": "cell-308b7521d915b7a5",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# Indexing and Slicing\n",
    "\n",
    "print(l[0])\n",
    "print(l[-1])\n",
    "print(l[0:-1])\n",
    "print(l[0:-1:2])\n",
    "print(l[::2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "76fc2075e9f0ee47cbaebf6f5f9e27b1",
     "grade": false,
     "grade_id": "cell-efbeabee80d0665c",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# Tuple\n",
    "t = (1, 2, 3)\n",
    "print(t)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "9d30ff66175583c7e6456231e4776b4b",
     "grade": false,
     "grade_id": "cell-476c81f5a97c7925",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# Collection operations (Be careful):\n",
    "t2  = (9, 8, 7)\n",
    "print(t + t2)\n",
    "print(t * 3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "55a403b0b40034d7fb12305048678764",
     "grade": false,
     "grade_id": "cell-237a8c10072cb49f",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# Dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "25e585f66dc3471eb22ef2beb5ec1000",
     "grade": false,
     "grade_id": "cell-45b86524ef35df72",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "dictionary = {\n",
    "    'a': 1,\n",
    "    2: 'b',\n",
    "    'c': 3,\n",
    "}\n",
    "dictionary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "642ce33a2c016659e61a6ad2538dd3a8",
     "grade": false,
     "grade_id": "cell-03ec489ef2411990",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "dictionary[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "4eb5b93d7c5766982b520466900a17f6",
     "grade": false,
     "grade_id": "cell-2a9786f2f18556fa",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "dictionary.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "6fa357dbb80a4ff4e010ec352574cd7f",
     "grade": false,
     "grade_id": "cell-a34f021e89aec1c2",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "dictionary.values()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "54844435b0bb6971ef4fb6bdfc37cfbe",
     "grade": false,
     "grade_id": "cell-44d309a15a6bfb00",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "dictionary.items()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "bd7680e1a668c2a9c3cfa0ac9d58ccd8",
     "grade": false,
     "grade_id": "cell-5b6a328a4568670b",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "dictionary = {}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "531cf88083df9536c0748e9a78c477b0",
     "grade": false,
     "grade_id": "cell-91f075a04d39af81",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Conditions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "517d479b3ce7f58cfe7f2fb54e050a95",
     "grade": false,
     "grade_id": "cell-413e118302f579f5",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "a = 6\n",
    "if a <= 2:\n",
    "    b = 2\n",
    "elif a < 10:\n",
    "    b = 3\n",
    "else:\n",
    "    b = 4\n",
    "b "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "f64026bed72cf2caa39e75958c71ae78",
     "grade": false,
     "grade_id": "cell-d791d71d3f51f506",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "if (a == 2) and (b == 3):\n",
    "    c = 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "c20a16472fdca6095a4e6183e6fac468",
     "grade": false,
     "grade_id": "cell-d89560ba654e22c0",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "d = None\n",
    "if a == 2 or d is None:\n",
    "    if d is not None:\n",
    "        c = None"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "c94625512a014535c79b211566a1589f",
     "grade": false,
     "grade_id": "cell-e097824630408777",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Loops"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "2445d3a97ee5a2dedf4e8224a3751187",
     "grade": false,
     "grade_id": "cell-f22fd07d76e2bf1c",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "l = list(range(5))\n",
    "l2 = []\n",
    "for entry in l:\n",
    "    print(entry ** 2)\n",
    "    l2.append(entry ** 2)\n",
    "\n",
    "for index in range(len(l)):\n",
    "    print(l[index] ** 2)\n",
    "    l2.append(l[index] ** 2)\n",
    "    \n",
    "for index, entry in enumerate(l):\n",
    "    print(entry ** 2)\n",
    "    l2.append(entry ** 2)\n",
    "    \n",
    "print(l2)\n",
    "    \n",
    "l"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "1a4102f5f7100d76e71ebe0335150c04",
     "grade": false,
     "grade_id": "cell-caad14285e303e07",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# List comprehensions:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "7045a89c1019ed45cffa795db738f662",
     "grade": false,
     "grade_id": "cell-2bb6a18fd4059c95",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "l = list(range(50))\n",
    "\n",
    "l2 = [entry ** 2 for entry in l]\n",
    "# print(l2)\n",
    "l2 = [\n",
    "    entry ** 2\n",
    "    for entry in l\n",
    "    if entry ** 2 >= 100\n",
    "]\n",
    "print(l2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "6a8787036ba5544388253dab4b047d53",
     "grade": false,
     "grade_id": "cell-6e01f751959a2cfb",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Dict comprehensions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "74299404e0d6f3c0e727caf66b674595",
     "grade": false,
     "grade_id": "cell-2892bbc072950fc2",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "d2 = {\n",
    "    entry: entry ** 2\n",
    "    for entry in l\n",
    "    if entry ** 2 >= 100\n",
    "}\n",
    "d2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "2fb27227035a69b94dfa9e57f58faf82",
     "grade": false,
     "grade_id": "cell-9be569418ecf1e2b",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "## Collections exercise"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "ede7f2580c96f0b80f2cf35c2bb3f318",
     "grade": false,
     "grade_id": "cell-7a68762a97db6b60",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "Create a list of 10 elements consisting of the first 10 alphabet letters\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "0dd2c3e99e91f776022a7c6df6a8837e",
     "grade": false,
     "grade_id": "cell-b38aade7be78bf03",
     "locked": false,
     "schema_version": 3,
     "solution": true,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# YOUR CODE HERE\n",
    "raise NotImplementedError()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "70040c65db2b37226564e1edfda0e0ea",
     "grade": false,
     "grade_id": "cell-a3b88ea5a37d3e6f",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "Create another list that contains the 10 elements from above in reversed order"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "403482693d231b6e7b38854dba6fd3d7",
     "grade": false,
     "grade_id": "cell-152f0f12ecd564f9",
     "locked": false,
     "schema_version": 3,
     "solution": true,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# YOUR CODE HERE\n",
    "raise NotImplementedError()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "52751d32b01cf3792486542f53652e01",
     "grade": false,
     "grade_id": "cell-901ec31b5038d6d8",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "Create a dictionary with two key-value pairs.\n",
    "First key 'A' contains the first list with 10 alphabet letters in correct order, and second key 'B' contains the second list with the reversed order letters."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "dc837aa3dc1cedc6d3912e9b0cb2e0c8",
     "grade": false,
     "grade_id": "cell-dfc2f5df094c10c2",
     "locked": false,
     "schema_version": 3,
     "solution": true,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# YOUR CODE HERE\n",
    "raise NotImplementedError()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "80dbe4f5a8505cd8e615962d1f6e95ae",
     "grade": false,
     "grade_id": "cell-8d4e4929c9d77ec9",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "Create three tuples of size 1 and add them to a list. Each tuple shall contain a dictionary with 5 keys that are enumerated integers and the corresponding values are these integers times ten.\n",
    "Each tuple's dictionary is continuing the enumeration of the previous dictionary.\n",
    "Print each key and value pair by iterating through the list."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "a5f3770627cc18d90ecfd92074762dba",
     "grade": false,
     "grade_id": "cell-6fd43f871ac9bac9",
     "locked": false,
     "schema_version": 3,
     "solution": true,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# YOUR CODE HERE\n",
    "raise NotImplementedError()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "5c51332eb5a6ea8c570035294cc6ad01",
     "grade": false,
     "grade_id": "cell-346eeb773872f4ef",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Functions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "4ce4296222740d15f1adc1f012aa4fdb",
     "grade": false,
     "grade_id": "cell-8303b3bc3c0369f1",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "def sub(a_val, b_val):\n",
    "    \"\"\"Calculate a - b\"\"\"\n",
    "    return a_val - b_val\n",
    "\n",
    "a = 2\n",
    "b = 1\n",
    "\n",
    "print(sub(a, b))\n",
    "print(sub(b, a))\n",
    "print(sub(b_val=b, a_val=a))\n",
    "print(sub(a_val=a, b_val=b))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "ce0706b865e99281fcae087bb57ad1e8",
     "grade": false,
     "grade_id": "cell-ad78de9fa027c230",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Classes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "3736a6aaa5b2e66f1df9ddf484883b4e",
     "grade": false,
     "grade_id": "cell-a8132e5ab2359dd3",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "class Dog:\n",
    "    \"\"\"Represents a dog.\"\"\"\n",
    "    def __init__(self, name):\n",
    "        self.name = name\n",
    "        \n",
    "    def sit(self):\n",
    "        print(self.name, 'is sitting.')\n",
    "        \n",
    "dog = Dog('Lucky')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "08a4068b17bef11695b2425cdd54380f",
     "grade": false,
     "grade_id": "cell-9d04c3054a090f12",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "dog.sit()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "95aba48bf43d5f4a1f2ef07f280ff9fe",
     "grade": false,
     "grade_id": "cell-ce67bb9caa79a523",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "## Function and Classes exercise\n",
    "Write a class `Cat` with an init function that takes `breed` as argument and sets the same attribute.\n",
    "\n",
    "If the `breed` argument is neither 'Balinese' nor 'Bengal', an error statement is to be printed.\n",
    "\n",
    "Give the cat a function `pet()`: If the cat is balinese, print 'meow', if the cat is bengal, print 'purr'.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "7f55fb7fb97bd80c8173b7f7d3e0bb9b",
     "grade": false,
     "grade_id": "cell-cc4caad8e103d54f",
     "locked": false,
     "schema_version": 3,
     "solution": true,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "# YOUR CODE HERE\n",
    "raise NotImplementedError()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "1ebf501009b27aa863e8041c35d581b0",
     "grade": false,
     "grade_id": "cell-e1c5930ef6822a17",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "Create a class `CrazyCatLady` which initializes without arguments an attribute `cats`, which is a list of 10 balinese and 5 bengal cats.\n",
    "\n",
    "Create a class-function `throw`, which removes one cat from her set of cats.\n",
    "\n",
    "Create a class-function `talk_to_cats`, which returns a dictionary of her remaining cats with keys being random names and values being the corresponding cat. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "83190f578867cfa2d1301cb059495e05",
     "grade": false,
     "grade_id": "cell-2474b2db211decf9",
     "locked": false,
     "schema_version": 3,
     "solution": true,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "import random\n",
    "# YOUR CODE HERE\n",
    "raise NotImplementedError()\n",
    "ccl = CrazyCatLady()\n",
    "ccl.throw()\n",
    "ccl.throw()\n",
    "ccl.throw()\n",
    "ccl.throw()\n",
    "print(ccl.talk_to_cats())\n",
    "ccl.throw()\n",
    "ccl.throw()\n",
    "ccl.throw()\n",
    "ccl.talk_to_cats()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "markdown",
     "checksum": "e5eacdf01b3315700b9f2eb92201c9ff",
     "grade": false,
     "grade_id": "cell-b838144fd880432d",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "# Outlook numerical computing\n",
    "\n",
    "Matrix Multiplication.\n",
    "Program the multiplication of the matrices with `for` loops:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "b0fdbe5cf431596cbe45bde7281dd4fe",
     "grade": false,
     "grade_id": "cell-7809078b51b1f9a1",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "A = [\n",
    "    [1, 2, 3],\n",
    "    [4, 5, 6],\n",
    "]\n",
    "B = [\n",
    "    [7, 8],\n",
    "    [9, 10],\n",
    "    [11, 12],\n",
    "]\n",
    "C = [\n",
    "    [0, 0],\n",
    "    [0, 0],\n",
    "]\n",
    "\n",
    "# C = A * B\n",
    "for i, a_ in enumerate(A):\n",
    "    for a, b_ in zip(a_, B):\n",
    "        for j, b in enumerate(b_):\n",
    "            C[i][j] += a * b\n",
    "\n",
    "C"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "deletable": false,
    "editable": false,
    "nbgrader": {
     "cell_type": "code",
     "checksum": "bb417c7b7543ce00ba96cc16a0a0eeed",
     "grade": false,
     "grade_id": "cell-50f07c286919f4f0",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "np.matmul(A, B)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
